namespace RIS.TMP.WEB.APP.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AllContext3 : DbMigration
    {
        public override void Up()
        {
            AddColumn("dbo.MRestoreToRepair", "PlanProject", c => c.Int());
            AddColumn("dbo.MRestoreToRepair", "SentTodate", c => c.DateTime());
            AddColumn("dbo.MRestoreToRepair", "TimeSuc", c => c.DateTime());
            AddColumn("dbo.MRestoreToAdmin", "PlanProject", c => c.Int());
            AlterColumn("dbo.MRestoreToRepair", "ResId", c => c.Int());
            AlterColumn("dbo.MRestoreToRepair", "ChpId", c => c.Int());
            AlterColumn("dbo.MRestoreToRepair", "OutId", c => c.Int());
            AlterColumn("dbo.MRestoreToRepair", "StatusReId", c => c.Int());
            AlterColumn("dbo.MRestoreToRepair", "StatusClose", c => c.DateTime());
            AlterColumn("dbo.MRestoreToRepair", "CreateWhen", c => c.DateTime());
            AddForeignKey("dbo.MRestoreToRepair", "ResId", "dbo.MRestoreToAdmin", "ResId");
            AddForeignKey("dbo.MRestoreToRepair", "ChpId", "dbo.CCheckPlan", "ChpId");
            AddForeignKey("dbo.MRestoreToRepair", "OutId", "dbo.COutsource", "OutId");
            AddForeignKey("dbo.MRestoreToRepair", "StatusReId", "dbo.CStatusRepair", "StatusReId");
            CreateIndex("dbo.MRestoreToRepair", "ResId");
            CreateIndex("dbo.MRestoreToRepair", "ChpId");
            CreateIndex("dbo.MRestoreToRepair", "OutId");
            CreateIndex("dbo.MRestoreToRepair", "StatusReId");
            DropColumn("dbo.MRestoreToRepair", "BrId");
            DropColumn("dbo.MRestoreToRepair", "ReJobsiteNo");
            DropColumn("dbo.MRestoreToRepair", "CReId");
            DropColumn("dbo.MRestoreToRepair", "AdminNo");
            DropColumn("dbo.MRestoreToRepair", "Firstdate");
            DropColumn("dbo.MRestoreToRepair", "Lastdate");
        }
        
        public override void Down()
        {
            AddColumn("dbo.MRestoreToRepair", "Lastdate", c => c.DateTime(nullable: false));
            AddColumn("dbo.MRestoreToRepair", "Firstdate", c => c.DateTime(nullable: false));
            AddColumn("dbo.MRestoreToRepair", "AdminNo", c => c.Int(nullable: false));
            AddColumn("dbo.MRestoreToRepair", "CReId", c => c.Int(nullable: false));
            AddColumn("dbo.MRestoreToRepair", "ReJobsiteNo", c => c.Int(nullable: false));
            AddColumn("dbo.MRestoreToRepair", "BrId", c => c.Int(nullable: false));
            DropIndex("dbo.MRestoreToRepair", new[] { "StatusReId" });
            DropIndex("dbo.MRestoreToRepair", new[] { "OutId" });
            DropIndex("dbo.MRestoreToRepair", new[] { "ChpId" });
            DropIndex("dbo.MRestoreToRepair", new[] { "ResId" });
            DropForeignKey("dbo.MRestoreToRepair", "StatusReId", "dbo.CStatusRepair");
            DropForeignKey("dbo.MRestoreToRepair", "OutId", "dbo.COutsource");
            DropForeignKey("dbo.MRestoreToRepair", "ChpId", "dbo.CCheckPlan");
            DropForeignKey("dbo.MRestoreToRepair", "ResId", "dbo.MRestoreToAdmin");
            AlterColumn("dbo.MRestoreToRepair", "CreateWhen", c => c.DateTime(nullable: false));
            AlterColumn("dbo.MRestoreToRepair", "StatusClose", c => c.Int(nullable: false));
            AlterColumn("dbo.MRestoreToRepair", "StatusReId", c => c.Int(nullable: false));
            AlterColumn("dbo.MRestoreToRepair", "OutId", c => c.Int(nullable: false));
            AlterColumn("dbo.MRestoreToRepair", "ChpId", c => c.Int(nullable: false));
            AlterColumn("dbo.MRestoreToRepair", "ResId", c => c.Int(nullable: false));
            DropColumn("dbo.MRestoreToAdmin", "PlanProject");
            DropColumn("dbo.MRestoreToRepair", "TimeSuc");
            DropColumn("dbo.MRestoreToRepair", "SentTodate");
            DropColumn("dbo.MRestoreToRepair", "PlanProject");
        }
    }
}
